/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.manager.search;

import br.com.deployment.daoImpl.DeterminationDAOImpl;
import br.com.deployment.entities.Determinations;
import br.com.deployment.utils.Msg;
import br.com.depoyment.VO.DeterminationAux;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author luciano
 */
@ManagedBean
@SessionScoped
public class ManagerCloseDetermination {
    
    @EJB
    DeterminationDAOImpl determinationService;
    
    Determinations determinations;
    
    private String textToClose;
    
    public List<DeterminationAux> findAll(){
        List<DeterminationAux> determinations = determinationService.findAllDeterminations();
        System.out.println(determinations);
        return determinations;
    }
    
    public void closeDetermination(){
        this.determinations.setCloseDescription(textToClose);
        this.determinations.setOpen(false);
        determinationService.update(determinations);
        Msg.messagemInfo("Determinação fechada.");
        this.textToClose = "";
    }

    public Determinations getDeterminations() {
        return determinations;
    }

    public void setDeterminations(Determinations determinations) {
        this.determinations = determinations;
    }

    public String getTextToClose() {
        return textToClose;
    }

    public void setTextToClose(String textToClose) {
        this.textToClose = textToClose;
    }
    
    
    
    
    
    
}
